{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "6c1ae2a7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "totoal blocks num: 54\n",
      "0:0.009259259259259259\n",
      "1:0.018518518518518517\n",
      "2:0.027777777777777776\n",
      "3:0.037037037037037035\n",
      "4:0.046296296296296294\n",
      "5:0.05555555555555555\n",
      "6:0.06481481481481481\n",
      "7:0.07407407407407407\n",
      "8:0.08333333333333333\n",
      "9:0.09259259259259259\n",
      "10:0.10185185185185185\n",
      "11:0.1111111111111111\n",
      "12:0.12037037037037036\n",
      "13:0.12962962962962962\n",
      "14:0.1388888888888889\n",
      "15:0.14814814814814814\n",
      "16:0.1574074074074074\n",
      "17:0.16666666666666666\n",
      "18:0.17592592592592593\n",
      "19:0.18518518518518517\n",
      "20:0.19444444444444445\n",
      "21:0.2037037037037037\n",
      "22:0.21296296296296297\n",
      "23:0.2222222222222222\n",
      "24:0.23148148148148148\n",
      "25:0.24074074074074073\n",
      "26:0.25\n",
      "27:0.25925925925925924\n",
      "28:0.26851851851851855\n",
      "29:0.2777777777777778\n",
      "30:0.28703703703703703\n",
      "31:0.2962962962962963\n",
      "32:0.3055555555555556\n",
      "33:0.3148148148148148\n",
      "34:0.32407407407407407\n",
      "35:0.3333333333333333\n",
      "36:0.3425925925925926\n",
      "37:0.35185185185185186\n",
      "38:0.3611111111111111\n",
      "39:0.37037037037037035\n",
      "40:0.37962962962962965\n",
      "41:0.3888888888888889\n",
      "42:0.39814814814814814\n",
      "43:0.4074074074074074\n",
      "44:0.4166666666666667\n",
      "45:0.42592592592592593\n",
      "46:0.4351851851851852\n",
      "47:0.4444444444444444\n",
      "48:0.4537037037037037\n",
      "49:0.46296296296296297\n",
      "50:0.4722222222222222\n",
      "51:0.48148148148148145\n",
      "52:0.49074074074074076\n",
      "53:0.5\n"
     ]
    }
   ],
   "source": [
    "import torch\n",
    "from models import resnet110\n",
    "# 初始化，并加载预训练权重\n",
    "torch_model = resnet110(pretrained=True, checkpoint='checkpoint/model_best.pth')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "c6844536",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "totoal blocks num: 54\n",
      "0:0.009259259259259259\n",
      "1:0.018518518518518517\n",
      "2:0.027777777777777776\n",
      "3:0.037037037037037035\n",
      "4:0.046296296296296294\n",
      "5:0.05555555555555555\n",
      "6:0.06481481481481481\n",
      "7:0.07407407407407407\n",
      "8:0.08333333333333333\n",
      "9:0.09259259259259259\n",
      "10:0.10185185185185185\n",
      "11:0.1111111111111111\n",
      "12:0.12037037037037036\n",
      "13:0.12962962962962962\n",
      "14:0.1388888888888889\n",
      "15:0.14814814814814814\n",
      "16:0.1574074074074074\n",
      "17:0.16666666666666666\n",
      "18:0.17592592592592593\n",
      "19:0.18518518518518517\n",
      "20:0.19444444444444445\n",
      "21:0.2037037037037037\n",
      "22:0.21296296296296297\n",
      "23:0.2222222222222222\n",
      "24:0.23148148148148148\n",
      "25:0.24074074074074073\n",
      "26:0.25\n",
      "27:0.25925925925925924\n",
      "28:0.26851851851851855\n",
      "29:0.2777777777777778\n",
      "30:0.28703703703703703\n",
      "31:0.2962962962962963\n",
      "32:0.3055555555555556\n",
      "33:0.3148148148148148\n",
      "34:0.32407407407407407\n",
      "35:0.3333333333333333\n",
      "36:0.3425925925925926\n",
      "37:0.35185185185185186\n",
      "38:0.3611111111111111\n",
      "39:0.37037037037037035\n",
      "40:0.37962962962962965\n",
      "41:0.3888888888888889\n",
      "42:0.39814814814814814\n",
      "43:0.4074074074074074\n",
      "44:0.4166666666666667\n",
      "45:0.42592592592592593\n",
      "46:0.4351851851851852\n",
      "47:0.4444444444444444\n",
      "48:0.4537037037037037\n",
      "49:0.46296296296296297\n",
      "50:0.4722222222222222\n",
      "51:0.48148148148148145\n",
      "52:0.49074074074074076\n",
      "53:0.5\n"
     ]
    }
   ],
   "source": [
    "import torch\n",
    "from models_paddle import resnet110\n",
    "# 初始化，并加载预训练权重\n",
    "paddle_model = resnet110(checkpoint=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "c01c9fae",
   "metadata": {},
   "outputs": [],
   "source": [
    "#权重转换函数\n",
    "from collections import OrderedDict\n",
    "\n",
    "def load_pytorch_pretrain_model(paddle_model, pytorch_state_dict):\n",
    "\n",
    "    paddle_weight=paddle_model.state_dict()\n",
    "    print(\"paddle num_params:\",len(paddle_weight))\n",
    "    print(\"torch num_params:\", len(pytorch_state_dict))\n",
    "    new_weight_dict=OrderedDict()\n",
    "\n",
    "    torch_key_list=[]\n",
    "    for key in pytorch_state_dict.keys():\n",
    "        if \"num_batches_tracked\" in key:\n",
    "            continue\n",
    "        torch_key_list.append(key)\n",
    "\n",
    "    for torch_key, paddle_key in zip(torch_key_list, paddle_weight.keys()):\n",
    "        print(torch_key, paddle_key, pytorch_state_dict[torch_key].shape,paddle_weight[paddle_key].shape)\n",
    "        if len(pytorch_state_dict[torch_key].shape) == 0:\n",
    "            continue\n",
    "        ##handle all FC weight cases\n",
    "        if (\"fc\" in torch_key and \"weight\" in torch_key) or (len(pytorch_state_dict[torch_key].shape)==2 and pytorch_state_dict[torch_key].shape[0] == pytorch_state_dict[torch_key].shape[1]):\n",
    "            new_weight_dict[paddle_key] = pytorch_state_dict[torch_key].cpu().detach().numpy().T.astype(\"float32\")\n",
    "        elif int(paddle_weight[paddle_key].shape[-1])==int(pytorch_state_dict[torch_key].shape[-1])  :\n",
    "            new_weight_dict[paddle_key]=pytorch_state_dict[torch_key].cpu().detach().numpy().astype(\"float32\")\n",
    "        else:\n",
    "            new_weight_dict[paddle_key] = pytorch_state_dict[torch_key].cpu().detach().numpy().T.astype(\"float32\")\n",
    "    paddle_model.set_dict(new_weight_dict)\n",
    "    return paddle_model.state_dict()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "9be2f7ca",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "paddle num_params: 547\n",
      "torch num_params: 656\n",
      "conv1.weight conv1.weight torch.Size([16, 3, 3, 3]) [16, 3, 3, 3]\n",
      "bn1.weight bn1.weight torch.Size([16]) [16]\n",
      "bn1.bias bn1.bias torch.Size([16]) [16]\n",
      "bn1.running_mean bn1._mean torch.Size([16]) [16]\n",
      "bn1.running_var bn1._variance torch.Size([16]) [16]\n",
      "layer1.0.conv1.weight layer1.0.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.0.bn1.weight layer1.0.bn1.weight torch.Size([16]) [16]\n",
      "layer1.0.bn1.bias layer1.0.bn1.bias torch.Size([16]) [16]\n",
      "layer1.0.bn1.running_mean layer1.0.bn1._mean torch.Size([16]) [16]\n",
      "layer1.0.bn1.running_var layer1.0.bn1._variance torch.Size([16]) [16]\n",
      "layer1.0.conv2.weight layer1.0.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.0.bn2.weight layer1.0.bn2.weight torch.Size([16]) [16]\n",
      "layer1.0.bn2.bias layer1.0.bn2.bias torch.Size([16]) [16]\n",
      "layer1.0.bn2.running_mean layer1.0.bn2._mean torch.Size([16]) [16]\n",
      "layer1.0.bn2.running_var layer1.0.bn2._variance torch.Size([16]) [16]\n",
      "layer1.1.conv1.weight layer1.1.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.1.bn1.weight layer1.1.bn1.weight torch.Size([16]) [16]\n",
      "layer1.1.bn1.bias layer1.1.bn1.bias torch.Size([16]) [16]\n",
      "layer1.1.bn1.running_mean layer1.1.bn1._mean torch.Size([16]) [16]\n",
      "layer1.1.bn1.running_var layer1.1.bn1._variance torch.Size([16]) [16]\n",
      "layer1.1.conv2.weight layer1.1.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.1.bn2.weight layer1.1.bn2.weight torch.Size([16]) [16]\n",
      "layer1.1.bn2.bias layer1.1.bn2.bias torch.Size([16]) [16]\n",
      "layer1.1.bn2.running_mean layer1.1.bn2._mean torch.Size([16]) [16]\n",
      "layer1.1.bn2.running_var layer1.1.bn2._variance torch.Size([16]) [16]\n",
      "layer1.2.conv1.weight layer1.2.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.2.bn1.weight layer1.2.bn1.weight torch.Size([16]) [16]\n",
      "layer1.2.bn1.bias layer1.2.bn1.bias torch.Size([16]) [16]\n",
      "layer1.2.bn1.running_mean layer1.2.bn1._mean torch.Size([16]) [16]\n",
      "layer1.2.bn1.running_var layer1.2.bn1._variance torch.Size([16]) [16]\n",
      "layer1.2.conv2.weight layer1.2.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.2.bn2.weight layer1.2.bn2.weight torch.Size([16]) [16]\n",
      "layer1.2.bn2.bias layer1.2.bn2.bias torch.Size([16]) [16]\n",
      "layer1.2.bn2.running_mean layer1.2.bn2._mean torch.Size([16]) [16]\n",
      "layer1.2.bn2.running_var layer1.2.bn2._variance torch.Size([16]) [16]\n",
      "layer1.3.conv1.weight layer1.3.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.3.bn1.weight layer1.3.bn1.weight torch.Size([16]) [16]\n",
      "layer1.3.bn1.bias layer1.3.bn1.bias torch.Size([16]) [16]\n",
      "layer1.3.bn1.running_mean layer1.3.bn1._mean torch.Size([16]) [16]\n",
      "layer1.3.bn1.running_var layer1.3.bn1._variance torch.Size([16]) [16]\n",
      "layer1.3.conv2.weight layer1.3.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.3.bn2.weight layer1.3.bn2.weight torch.Size([16]) [16]\n",
      "layer1.3.bn2.bias layer1.3.bn2.bias torch.Size([16]) [16]\n",
      "layer1.3.bn2.running_mean layer1.3.bn2._mean torch.Size([16]) [16]\n",
      "layer1.3.bn2.running_var layer1.3.bn2._variance torch.Size([16]) [16]\n",
      "layer1.4.conv1.weight layer1.4.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.4.bn1.weight layer1.4.bn1.weight torch.Size([16]) [16]\n",
      "layer1.4.bn1.bias layer1.4.bn1.bias torch.Size([16]) [16]\n",
      "layer1.4.bn1.running_mean layer1.4.bn1._mean torch.Size([16]) [16]\n",
      "layer1.4.bn1.running_var layer1.4.bn1._variance torch.Size([16]) [16]\n",
      "layer1.4.conv2.weight layer1.4.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.4.bn2.weight layer1.4.bn2.weight torch.Size([16]) [16]\n",
      "layer1.4.bn2.bias layer1.4.bn2.bias torch.Size([16]) [16]\n",
      "layer1.4.bn2.running_mean layer1.4.bn2._mean torch.Size([16]) [16]\n",
      "layer1.4.bn2.running_var layer1.4.bn2._variance torch.Size([16]) [16]\n",
      "layer1.5.conv1.weight layer1.5.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.5.bn1.weight layer1.5.bn1.weight torch.Size([16]) [16]\n",
      "layer1.5.bn1.bias layer1.5.bn1.bias torch.Size([16]) [16]\n",
      "layer1.5.bn1.running_mean layer1.5.bn1._mean torch.Size([16]) [16]\n",
      "layer1.5.bn1.running_var layer1.5.bn1._variance torch.Size([16]) [16]\n",
      "layer1.5.conv2.weight layer1.5.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.5.bn2.weight layer1.5.bn2.weight torch.Size([16]) [16]\n",
      "layer1.5.bn2.bias layer1.5.bn2.bias torch.Size([16]) [16]\n",
      "layer1.5.bn2.running_mean layer1.5.bn2._mean torch.Size([16]) [16]\n",
      "layer1.5.bn2.running_var layer1.5.bn2._variance torch.Size([16]) [16]\n",
      "layer1.6.conv1.weight layer1.6.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.6.bn1.weight layer1.6.bn1.weight torch.Size([16]) [16]\n",
      "layer1.6.bn1.bias layer1.6.bn1.bias torch.Size([16]) [16]\n",
      "layer1.6.bn1.running_mean layer1.6.bn1._mean torch.Size([16]) [16]\n",
      "layer1.6.bn1.running_var layer1.6.bn1._variance torch.Size([16]) [16]\n",
      "layer1.6.conv2.weight layer1.6.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.6.bn2.weight layer1.6.bn2.weight torch.Size([16]) [16]\n",
      "layer1.6.bn2.bias layer1.6.bn2.bias torch.Size([16]) [16]\n",
      "layer1.6.bn2.running_mean layer1.6.bn2._mean torch.Size([16]) [16]\n",
      "layer1.6.bn2.running_var layer1.6.bn2._variance torch.Size([16]) [16]\n",
      "layer1.7.conv1.weight layer1.7.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.7.bn1.weight layer1.7.bn1.weight torch.Size([16]) [16]\n",
      "layer1.7.bn1.bias layer1.7.bn1.bias torch.Size([16]) [16]\n",
      "layer1.7.bn1.running_mean layer1.7.bn1._mean torch.Size([16]) [16]\n",
      "layer1.7.bn1.running_var layer1.7.bn1._variance torch.Size([16]) [16]\n",
      "layer1.7.conv2.weight layer1.7.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.7.bn2.weight layer1.7.bn2.weight torch.Size([16]) [16]\n",
      "layer1.7.bn2.bias layer1.7.bn2.bias torch.Size([16]) [16]\n",
      "layer1.7.bn2.running_mean layer1.7.bn2._mean torch.Size([16]) [16]\n",
      "layer1.7.bn2.running_var layer1.7.bn2._variance torch.Size([16]) [16]\n",
      "layer1.8.conv1.weight layer1.8.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.8.bn1.weight layer1.8.bn1.weight torch.Size([16]) [16]\n",
      "layer1.8.bn1.bias layer1.8.bn1.bias torch.Size([16]) [16]\n",
      "layer1.8.bn1.running_mean layer1.8.bn1._mean torch.Size([16]) [16]\n",
      "layer1.8.bn1.running_var layer1.8.bn1._variance torch.Size([16]) [16]\n",
      "layer1.8.conv2.weight layer1.8.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.8.bn2.weight layer1.8.bn2.weight torch.Size([16]) [16]\n",
      "layer1.8.bn2.bias layer1.8.bn2.bias torch.Size([16]) [16]\n",
      "layer1.8.bn2.running_mean layer1.8.bn2._mean torch.Size([16]) [16]\n",
      "layer1.8.bn2.running_var layer1.8.bn2._variance torch.Size([16]) [16]\n",
      "layer1.9.conv1.weight layer1.9.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.9.bn1.weight layer1.9.bn1.weight torch.Size([16]) [16]\n",
      "layer1.9.bn1.bias layer1.9.bn1.bias torch.Size([16]) [16]\n",
      "layer1.9.bn1.running_mean layer1.9.bn1._mean torch.Size([16]) [16]\n",
      "layer1.9.bn1.running_var layer1.9.bn1._variance torch.Size([16]) [16]\n",
      "layer1.9.conv2.weight layer1.9.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.9.bn2.weight layer1.9.bn2.weight torch.Size([16]) [16]\n",
      "layer1.9.bn2.bias layer1.9.bn2.bias torch.Size([16]) [16]\n",
      "layer1.9.bn2.running_mean layer1.9.bn2._mean torch.Size([16]) [16]\n",
      "layer1.9.bn2.running_var layer1.9.bn2._variance torch.Size([16]) [16]\n",
      "layer1.10.conv1.weight layer1.10.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.10.bn1.weight layer1.10.bn1.weight torch.Size([16]) [16]\n",
      "layer1.10.bn1.bias layer1.10.bn1.bias torch.Size([16]) [16]\n",
      "layer1.10.bn1.running_mean layer1.10.bn1._mean torch.Size([16]) [16]\n",
      "layer1.10.bn1.running_var layer1.10.bn1._variance torch.Size([16]) [16]\n",
      "layer1.10.conv2.weight layer1.10.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.10.bn2.weight layer1.10.bn2.weight torch.Size([16]) [16]\n",
      "layer1.10.bn2.bias layer1.10.bn2.bias torch.Size([16]) [16]\n",
      "layer1.10.bn2.running_mean layer1.10.bn2._mean torch.Size([16]) [16]\n",
      "layer1.10.bn2.running_var layer1.10.bn2._variance torch.Size([16]) [16]\n",
      "layer1.11.conv1.weight layer1.11.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.11.bn1.weight layer1.11.bn1.weight torch.Size([16]) [16]\n",
      "layer1.11.bn1.bias layer1.11.bn1.bias torch.Size([16]) [16]\n",
      "layer1.11.bn1.running_mean layer1.11.bn1._mean torch.Size([16]) [16]\n",
      "layer1.11.bn1.running_var layer1.11.bn1._variance torch.Size([16]) [16]\n",
      "layer1.11.conv2.weight layer1.11.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.11.bn2.weight layer1.11.bn2.weight torch.Size([16]) [16]\n",
      "layer1.11.bn2.bias layer1.11.bn2.bias torch.Size([16]) [16]\n",
      "layer1.11.bn2.running_mean layer1.11.bn2._mean torch.Size([16]) [16]\n",
      "layer1.11.bn2.running_var layer1.11.bn2._variance torch.Size([16]) [16]\n",
      "layer1.12.conv1.weight layer1.12.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.12.bn1.weight layer1.12.bn1.weight torch.Size([16]) [16]\n",
      "layer1.12.bn1.bias layer1.12.bn1.bias torch.Size([16]) [16]\n",
      "layer1.12.bn1.running_mean layer1.12.bn1._mean torch.Size([16]) [16]\n",
      "layer1.12.bn1.running_var layer1.12.bn1._variance torch.Size([16]) [16]\n",
      "layer1.12.conv2.weight layer1.12.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.12.bn2.weight layer1.12.bn2.weight torch.Size([16]) [16]\n",
      "layer1.12.bn2.bias layer1.12.bn2.bias torch.Size([16]) [16]\n",
      "layer1.12.bn2.running_mean layer1.12.bn2._mean torch.Size([16]) [16]\n",
      "layer1.12.bn2.running_var layer1.12.bn2._variance torch.Size([16]) [16]\n",
      "layer1.13.conv1.weight layer1.13.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.13.bn1.weight layer1.13.bn1.weight torch.Size([16]) [16]\n",
      "layer1.13.bn1.bias layer1.13.bn1.bias torch.Size([16]) [16]\n",
      "layer1.13.bn1.running_mean layer1.13.bn1._mean torch.Size([16]) [16]\n",
      "layer1.13.bn1.running_var layer1.13.bn1._variance torch.Size([16]) [16]\n",
      "layer1.13.conv2.weight layer1.13.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.13.bn2.weight layer1.13.bn2.weight torch.Size([16]) [16]\n",
      "layer1.13.bn2.bias layer1.13.bn2.bias torch.Size([16]) [16]\n",
      "layer1.13.bn2.running_mean layer1.13.bn2._mean torch.Size([16]) [16]\n",
      "layer1.13.bn2.running_var layer1.13.bn2._variance torch.Size([16]) [16]\n",
      "layer1.14.conv1.weight layer1.14.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.14.bn1.weight layer1.14.bn1.weight torch.Size([16]) [16]\n",
      "layer1.14.bn1.bias layer1.14.bn1.bias torch.Size([16]) [16]\n",
      "layer1.14.bn1.running_mean layer1.14.bn1._mean torch.Size([16]) [16]\n",
      "layer1.14.bn1.running_var layer1.14.bn1._variance torch.Size([16]) [16]\n",
      "layer1.14.conv2.weight layer1.14.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.14.bn2.weight layer1.14.bn2.weight torch.Size([16]) [16]\n",
      "layer1.14.bn2.bias layer1.14.bn2.bias torch.Size([16]) [16]\n",
      "layer1.14.bn2.running_mean layer1.14.bn2._mean torch.Size([16]) [16]\n",
      "layer1.14.bn2.running_var layer1.14.bn2._variance torch.Size([16]) [16]\n",
      "layer1.15.conv1.weight layer1.15.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.15.bn1.weight layer1.15.bn1.weight torch.Size([16]) [16]\n",
      "layer1.15.bn1.bias layer1.15.bn1.bias torch.Size([16]) [16]\n",
      "layer1.15.bn1.running_mean layer1.15.bn1._mean torch.Size([16]) [16]\n",
      "layer1.15.bn1.running_var layer1.15.bn1._variance torch.Size([16]) [16]\n",
      "layer1.15.conv2.weight layer1.15.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.15.bn2.weight layer1.15.bn2.weight torch.Size([16]) [16]\n",
      "layer1.15.bn2.bias layer1.15.bn2.bias torch.Size([16]) [16]\n",
      "layer1.15.bn2.running_mean layer1.15.bn2._mean torch.Size([16]) [16]\n",
      "layer1.15.bn2.running_var layer1.15.bn2._variance torch.Size([16]) [16]\n",
      "layer1.16.conv1.weight layer1.16.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.16.bn1.weight layer1.16.bn1.weight torch.Size([16]) [16]\n",
      "layer1.16.bn1.bias layer1.16.bn1.bias torch.Size([16]) [16]\n",
      "layer1.16.bn1.running_mean layer1.16.bn1._mean torch.Size([16]) [16]\n",
      "layer1.16.bn1.running_var layer1.16.bn1._variance torch.Size([16]) [16]\n",
      "layer1.16.conv2.weight layer1.16.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.16.bn2.weight layer1.16.bn2.weight torch.Size([16]) [16]\n",
      "layer1.16.bn2.bias layer1.16.bn2.bias torch.Size([16]) [16]\n",
      "layer1.16.bn2.running_mean layer1.16.bn2._mean torch.Size([16]) [16]\n",
      "layer1.16.bn2.running_var layer1.16.bn2._variance torch.Size([16]) [16]\n",
      "layer1.17.conv1.weight layer1.17.conv1.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.17.bn1.weight layer1.17.bn1.weight torch.Size([16]) [16]\n",
      "layer1.17.bn1.bias layer1.17.bn1.bias torch.Size([16]) [16]\n",
      "layer1.17.bn1.running_mean layer1.17.bn1._mean torch.Size([16]) [16]\n",
      "layer1.17.bn1.running_var layer1.17.bn1._variance torch.Size([16]) [16]\n",
      "layer1.17.conv2.weight layer1.17.conv2.weight torch.Size([16, 16, 3, 3]) [16, 16, 3, 3]\n",
      "layer1.17.bn2.weight layer1.17.bn2.weight torch.Size([16]) [16]\n",
      "layer1.17.bn2.bias layer1.17.bn2.bias torch.Size([16]) [16]\n",
      "layer1.17.bn2.running_mean layer1.17.bn2._mean torch.Size([16]) [16]\n",
      "layer1.17.bn2.running_var layer1.17.bn2._variance torch.Size([16]) [16]\n",
      "layer2.0.conv1.weight layer2.0.conv1.weight torch.Size([32, 16, 3, 3]) [32, 16, 3, 3]\n",
      "layer2.0.bn1.weight layer2.0.bn1.weight torch.Size([32]) [32]\n",
      "layer2.0.bn1.bias layer2.0.bn1.bias torch.Size([32]) [32]\n",
      "layer2.0.bn1.running_mean layer2.0.bn1._mean torch.Size([32]) [32]\n",
      "layer2.0.bn1.running_var layer2.0.bn1._variance torch.Size([32]) [32]\n",
      "layer2.0.conv2.weight layer2.0.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.0.bn2.weight layer2.0.bn2.weight torch.Size([32]) [32]\n",
      "layer2.0.bn2.bias layer2.0.bn2.bias torch.Size([32]) [32]\n",
      "layer2.0.bn2.running_mean layer2.0.bn2._mean torch.Size([32]) [32]\n",
      "layer2.0.bn2.running_var layer2.0.bn2._variance torch.Size([32]) [32]\n",
      "layer2.1.conv1.weight layer2.1.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.1.bn1.weight layer2.1.bn1.weight torch.Size([32]) [32]\n",
      "layer2.1.bn1.bias layer2.1.bn1.bias torch.Size([32]) [32]\n",
      "layer2.1.bn1.running_mean layer2.1.bn1._mean torch.Size([32]) [32]\n",
      "layer2.1.bn1.running_var layer2.1.bn1._variance torch.Size([32]) [32]\n",
      "layer2.1.conv2.weight layer2.1.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.1.bn2.weight layer2.1.bn2.weight torch.Size([32]) [32]\n",
      "layer2.1.bn2.bias layer2.1.bn2.bias torch.Size([32]) [32]\n",
      "layer2.1.bn2.running_mean layer2.1.bn2._mean torch.Size([32]) [32]\n",
      "layer2.1.bn2.running_var layer2.1.bn2._variance torch.Size([32]) [32]\n",
      "layer2.2.conv1.weight layer2.2.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.2.bn1.weight layer2.2.bn1.weight torch.Size([32]) [32]\n",
      "layer2.2.bn1.bias layer2.2.bn1.bias torch.Size([32]) [32]\n",
      "layer2.2.bn1.running_mean layer2.2.bn1._mean torch.Size([32]) [32]\n",
      "layer2.2.bn1.running_var layer2.2.bn1._variance torch.Size([32]) [32]\n",
      "layer2.2.conv2.weight layer2.2.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.2.bn2.weight layer2.2.bn2.weight torch.Size([32]) [32]\n",
      "layer2.2.bn2.bias layer2.2.bn2.bias torch.Size([32]) [32]\n",
      "layer2.2.bn2.running_mean layer2.2.bn2._mean torch.Size([32]) [32]\n",
      "layer2.2.bn2.running_var layer2.2.bn2._variance torch.Size([32]) [32]\n",
      "layer2.3.conv1.weight layer2.3.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.3.bn1.weight layer2.3.bn1.weight torch.Size([32]) [32]\n",
      "layer2.3.bn1.bias layer2.3.bn1.bias torch.Size([32]) [32]\n",
      "layer2.3.bn1.running_mean layer2.3.bn1._mean torch.Size([32]) [32]\n",
      "layer2.3.bn1.running_var layer2.3.bn1._variance torch.Size([32]) [32]\n",
      "layer2.3.conv2.weight layer2.3.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.3.bn2.weight layer2.3.bn2.weight torch.Size([32]) [32]\n",
      "layer2.3.bn2.bias layer2.3.bn2.bias torch.Size([32]) [32]\n",
      "layer2.3.bn2.running_mean layer2.3.bn2._mean torch.Size([32]) [32]\n",
      "layer2.3.bn2.running_var layer2.3.bn2._variance torch.Size([32]) [32]\n",
      "layer2.4.conv1.weight layer2.4.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.4.bn1.weight layer2.4.bn1.weight torch.Size([32]) [32]\n",
      "layer2.4.bn1.bias layer2.4.bn1.bias torch.Size([32]) [32]\n",
      "layer2.4.bn1.running_mean layer2.4.bn1._mean torch.Size([32]) [32]\n",
      "layer2.4.bn1.running_var layer2.4.bn1._variance torch.Size([32]) [32]\n",
      "layer2.4.conv2.weight layer2.4.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.4.bn2.weight layer2.4.bn2.weight torch.Size([32]) [32]\n",
      "layer2.4.bn2.bias layer2.4.bn2.bias torch.Size([32]) [32]\n",
      "layer2.4.bn2.running_mean layer2.4.bn2._mean torch.Size([32]) [32]\n",
      "layer2.4.bn2.running_var layer2.4.bn2._variance torch.Size([32]) [32]\n",
      "layer2.5.conv1.weight layer2.5.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.5.bn1.weight layer2.5.bn1.weight torch.Size([32]) [32]\n",
      "layer2.5.bn1.bias layer2.5.bn1.bias torch.Size([32]) [32]\n",
      "layer2.5.bn1.running_mean layer2.5.bn1._mean torch.Size([32]) [32]\n",
      "layer2.5.bn1.running_var layer2.5.bn1._variance torch.Size([32]) [32]\n",
      "layer2.5.conv2.weight layer2.5.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.5.bn2.weight layer2.5.bn2.weight torch.Size([32]) [32]\n",
      "layer2.5.bn2.bias layer2.5.bn2.bias torch.Size([32]) [32]\n",
      "layer2.5.bn2.running_mean layer2.5.bn2._mean torch.Size([32]) [32]\n",
      "layer2.5.bn2.running_var layer2.5.bn2._variance torch.Size([32]) [32]\n",
      "layer2.6.conv1.weight layer2.6.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.6.bn1.weight layer2.6.bn1.weight torch.Size([32]) [32]\n",
      "layer2.6.bn1.bias layer2.6.bn1.bias torch.Size([32]) [32]\n",
      "layer2.6.bn1.running_mean layer2.6.bn1._mean torch.Size([32]) [32]\n",
      "layer2.6.bn1.running_var layer2.6.bn1._variance torch.Size([32]) [32]\n",
      "layer2.6.conv2.weight layer2.6.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.6.bn2.weight layer2.6.bn2.weight torch.Size([32]) [32]\n",
      "layer2.6.bn2.bias layer2.6.bn2.bias torch.Size([32]) [32]\n",
      "layer2.6.bn2.running_mean layer2.6.bn2._mean torch.Size([32]) [32]\n",
      "layer2.6.bn2.running_var layer2.6.bn2._variance torch.Size([32]) [32]\n",
      "layer2.7.conv1.weight layer2.7.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.7.bn1.weight layer2.7.bn1.weight torch.Size([32]) [32]\n",
      "layer2.7.bn1.bias layer2.7.bn1.bias torch.Size([32]) [32]\n",
      "layer2.7.bn1.running_mean layer2.7.bn1._mean torch.Size([32]) [32]\n",
      "layer2.7.bn1.running_var layer2.7.bn1._variance torch.Size([32]) [32]\n",
      "layer2.7.conv2.weight layer2.7.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.7.bn2.weight layer2.7.bn2.weight torch.Size([32]) [32]\n",
      "layer2.7.bn2.bias layer2.7.bn2.bias torch.Size([32]) [32]\n",
      "layer2.7.bn2.running_mean layer2.7.bn2._mean torch.Size([32]) [32]\n",
      "layer2.7.bn2.running_var layer2.7.bn2._variance torch.Size([32]) [32]\n",
      "layer2.8.conv1.weight layer2.8.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.8.bn1.weight layer2.8.bn1.weight torch.Size([32]) [32]\n",
      "layer2.8.bn1.bias layer2.8.bn1.bias torch.Size([32]) [32]\n",
      "layer2.8.bn1.running_mean layer2.8.bn1._mean torch.Size([32]) [32]\n",
      "layer2.8.bn1.running_var layer2.8.bn1._variance torch.Size([32]) [32]\n",
      "layer2.8.conv2.weight layer2.8.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.8.bn2.weight layer2.8.bn2.weight torch.Size([32]) [32]\n",
      "layer2.8.bn2.bias layer2.8.bn2.bias torch.Size([32]) [32]\n",
      "layer2.8.bn2.running_mean layer2.8.bn2._mean torch.Size([32]) [32]\n",
      "layer2.8.bn2.running_var layer2.8.bn2._variance torch.Size([32]) [32]\n",
      "layer2.9.conv1.weight layer2.9.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.9.bn1.weight layer2.9.bn1.weight torch.Size([32]) [32]\n",
      "layer2.9.bn1.bias layer2.9.bn1.bias torch.Size([32]) [32]\n",
      "layer2.9.bn1.running_mean layer2.9.bn1._mean torch.Size([32]) [32]\n",
      "layer2.9.bn1.running_var layer2.9.bn1._variance torch.Size([32]) [32]\n",
      "layer2.9.conv2.weight layer2.9.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.9.bn2.weight layer2.9.bn2.weight torch.Size([32]) [32]\n",
      "layer2.9.bn2.bias layer2.9.bn2.bias torch.Size([32]) [32]\n",
      "layer2.9.bn2.running_mean layer2.9.bn2._mean torch.Size([32]) [32]\n",
      "layer2.9.bn2.running_var layer2.9.bn2._variance torch.Size([32]) [32]\n",
      "layer2.10.conv1.weight layer2.10.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.10.bn1.weight layer2.10.bn1.weight torch.Size([32]) [32]\n",
      "layer2.10.bn1.bias layer2.10.bn1.bias torch.Size([32]) [32]\n",
      "layer2.10.bn1.running_mean layer2.10.bn1._mean torch.Size([32]) [32]\n",
      "layer2.10.bn1.running_var layer2.10.bn1._variance torch.Size([32]) [32]\n",
      "layer2.10.conv2.weight layer2.10.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.10.bn2.weight layer2.10.bn2.weight torch.Size([32]) [32]\n",
      "layer2.10.bn2.bias layer2.10.bn2.bias torch.Size([32]) [32]\n",
      "layer2.10.bn2.running_mean layer2.10.bn2._mean torch.Size([32]) [32]\n",
      "layer2.10.bn2.running_var layer2.10.bn2._variance torch.Size([32]) [32]\n",
      "layer2.11.conv1.weight layer2.11.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.11.bn1.weight layer2.11.bn1.weight torch.Size([32]) [32]\n",
      "layer2.11.bn1.bias layer2.11.bn1.bias torch.Size([32]) [32]\n",
      "layer2.11.bn1.running_mean layer2.11.bn1._mean torch.Size([32]) [32]\n",
      "layer2.11.bn1.running_var layer2.11.bn1._variance torch.Size([32]) [32]\n",
      "layer2.11.conv2.weight layer2.11.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.11.bn2.weight layer2.11.bn2.weight torch.Size([32]) [32]\n",
      "layer2.11.bn2.bias layer2.11.bn2.bias torch.Size([32]) [32]\n",
      "layer2.11.bn2.running_mean layer2.11.bn2._mean torch.Size([32]) [32]\n",
      "layer2.11.bn2.running_var layer2.11.bn2._variance torch.Size([32]) [32]\n",
      "layer2.12.conv1.weight layer2.12.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.12.bn1.weight layer2.12.bn1.weight torch.Size([32]) [32]\n",
      "layer2.12.bn1.bias layer2.12.bn1.bias torch.Size([32]) [32]\n",
      "layer2.12.bn1.running_mean layer2.12.bn1._mean torch.Size([32]) [32]\n",
      "layer2.12.bn1.running_var layer2.12.bn1._variance torch.Size([32]) [32]\n",
      "layer2.12.conv2.weight layer2.12.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.12.bn2.weight layer2.12.bn2.weight torch.Size([32]) [32]\n",
      "layer2.12.bn2.bias layer2.12.bn2.bias torch.Size([32]) [32]\n",
      "layer2.12.bn2.running_mean layer2.12.bn2._mean torch.Size([32]) [32]\n",
      "layer2.12.bn2.running_var layer2.12.bn2._variance torch.Size([32]) [32]\n",
      "layer2.13.conv1.weight layer2.13.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.13.bn1.weight layer2.13.bn1.weight torch.Size([32]) [32]\n",
      "layer2.13.bn1.bias layer2.13.bn1.bias torch.Size([32]) [32]\n",
      "layer2.13.bn1.running_mean layer2.13.bn1._mean torch.Size([32]) [32]\n",
      "layer2.13.bn1.running_var layer2.13.bn1._variance torch.Size([32]) [32]\n",
      "layer2.13.conv2.weight layer2.13.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.13.bn2.weight layer2.13.bn2.weight torch.Size([32]) [32]\n",
      "layer2.13.bn2.bias layer2.13.bn2.bias torch.Size([32]) [32]\n",
      "layer2.13.bn2.running_mean layer2.13.bn2._mean torch.Size([32]) [32]\n",
      "layer2.13.bn2.running_var layer2.13.bn2._variance torch.Size([32]) [32]\n",
      "layer2.14.conv1.weight layer2.14.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.14.bn1.weight layer2.14.bn1.weight torch.Size([32]) [32]\n",
      "layer2.14.bn1.bias layer2.14.bn1.bias torch.Size([32]) [32]\n",
      "layer2.14.bn1.running_mean layer2.14.bn1._mean torch.Size([32]) [32]\n",
      "layer2.14.bn1.running_var layer2.14.bn1._variance torch.Size([32]) [32]\n",
      "layer2.14.conv2.weight layer2.14.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.14.bn2.weight layer2.14.bn2.weight torch.Size([32]) [32]\n",
      "layer2.14.bn2.bias layer2.14.bn2.bias torch.Size([32]) [32]\n",
      "layer2.14.bn2.running_mean layer2.14.bn2._mean torch.Size([32]) [32]\n",
      "layer2.14.bn2.running_var layer2.14.bn2._variance torch.Size([32]) [32]\n",
      "layer2.15.conv1.weight layer2.15.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.15.bn1.weight layer2.15.bn1.weight torch.Size([32]) [32]\n",
      "layer2.15.bn1.bias layer2.15.bn1.bias torch.Size([32]) [32]\n",
      "layer2.15.bn1.running_mean layer2.15.bn1._mean torch.Size([32]) [32]\n",
      "layer2.15.bn1.running_var layer2.15.bn1._variance torch.Size([32]) [32]\n",
      "layer2.15.conv2.weight layer2.15.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.15.bn2.weight layer2.15.bn2.weight torch.Size([32]) [32]\n",
      "layer2.15.bn2.bias layer2.15.bn2.bias torch.Size([32]) [32]\n",
      "layer2.15.bn2.running_mean layer2.15.bn2._mean torch.Size([32]) [32]\n",
      "layer2.15.bn2.running_var layer2.15.bn2._variance torch.Size([32]) [32]\n",
      "layer2.16.conv1.weight layer2.16.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.16.bn1.weight layer2.16.bn1.weight torch.Size([32]) [32]\n",
      "layer2.16.bn1.bias layer2.16.bn1.bias torch.Size([32]) [32]\n",
      "layer2.16.bn1.running_mean layer2.16.bn1._mean torch.Size([32]) [32]\n",
      "layer2.16.bn1.running_var layer2.16.bn1._variance torch.Size([32]) [32]\n",
      "layer2.16.conv2.weight layer2.16.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.16.bn2.weight layer2.16.bn2.weight torch.Size([32]) [32]\n",
      "layer2.16.bn2.bias layer2.16.bn2.bias torch.Size([32]) [32]\n",
      "layer2.16.bn2.running_mean layer2.16.bn2._mean torch.Size([32]) [32]\n",
      "layer2.16.bn2.running_var layer2.16.bn2._variance torch.Size([32]) [32]\n",
      "layer2.17.conv1.weight layer2.17.conv1.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.17.bn1.weight layer2.17.bn1.weight torch.Size([32]) [32]\n",
      "layer2.17.bn1.bias layer2.17.bn1.bias torch.Size([32]) [32]\n",
      "layer2.17.bn1.running_mean layer2.17.bn1._mean torch.Size([32]) [32]\n",
      "layer2.17.bn1.running_var layer2.17.bn1._variance torch.Size([32]) [32]\n",
      "layer2.17.conv2.weight layer2.17.conv2.weight torch.Size([32, 32, 3, 3]) [32, 32, 3, 3]\n",
      "layer2.17.bn2.weight layer2.17.bn2.weight torch.Size([32]) [32]\n",
      "layer2.17.bn2.bias layer2.17.bn2.bias torch.Size([32]) [32]\n",
      "layer2.17.bn2.running_mean layer2.17.bn2._mean torch.Size([32]) [32]\n",
      "layer2.17.bn2.running_var layer2.17.bn2._variance torch.Size([32]) [32]\n",
      "layer3.0.conv1.weight layer3.0.conv1.weight torch.Size([64, 32, 3, 3]) [64, 32, 3, 3]\n",
      "layer3.0.bn1.weight layer3.0.bn1.weight torch.Size([64]) [64]\n",
      "layer3.0.bn1.bias layer3.0.bn1.bias torch.Size([64]) [64]\n",
      "layer3.0.bn1.running_mean layer3.0.bn1._mean torch.Size([64]) [64]\n",
      "layer3.0.bn1.running_var layer3.0.bn1._variance torch.Size([64]) [64]\n",
      "layer3.0.conv2.weight layer3.0.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.0.bn2.weight layer3.0.bn2.weight torch.Size([64]) [64]\n",
      "layer3.0.bn2.bias layer3.0.bn2.bias torch.Size([64]) [64]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "layer3.0.bn2.running_mean layer3.0.bn2._mean torch.Size([64]) [64]\n",
      "layer3.0.bn2.running_var layer3.0.bn2._variance torch.Size([64]) [64]\n",
      "layer3.1.conv1.weight layer3.1.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.1.bn1.weight layer3.1.bn1.weight torch.Size([64]) [64]\n",
      "layer3.1.bn1.bias layer3.1.bn1.bias torch.Size([64]) [64]\n",
      "layer3.1.bn1.running_mean layer3.1.bn1._mean torch.Size([64]) [64]\n",
      "layer3.1.bn1.running_var layer3.1.bn1._variance torch.Size([64]) [64]\n",
      "layer3.1.conv2.weight layer3.1.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.1.bn2.weight layer3.1.bn2.weight torch.Size([64]) [64]\n",
      "layer3.1.bn2.bias layer3.1.bn2.bias torch.Size([64]) [64]\n",
      "layer3.1.bn2.running_mean layer3.1.bn2._mean torch.Size([64]) [64]\n",
      "layer3.1.bn2.running_var layer3.1.bn2._variance torch.Size([64]) [64]\n",
      "layer3.2.conv1.weight layer3.2.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.2.bn1.weight layer3.2.bn1.weight torch.Size([64]) [64]\n",
      "layer3.2.bn1.bias layer3.2.bn1.bias torch.Size([64]) [64]\n",
      "layer3.2.bn1.running_mean layer3.2.bn1._mean torch.Size([64]) [64]\n",
      "layer3.2.bn1.running_var layer3.2.bn1._variance torch.Size([64]) [64]\n",
      "layer3.2.conv2.weight layer3.2.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.2.bn2.weight layer3.2.bn2.weight torch.Size([64]) [64]\n",
      "layer3.2.bn2.bias layer3.2.bn2.bias torch.Size([64]) [64]\n",
      "layer3.2.bn2.running_mean layer3.2.bn2._mean torch.Size([64]) [64]\n",
      "layer3.2.bn2.running_var layer3.2.bn2._variance torch.Size([64]) [64]\n",
      "layer3.3.conv1.weight layer3.3.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.3.bn1.weight layer3.3.bn1.weight torch.Size([64]) [64]\n",
      "layer3.3.bn1.bias layer3.3.bn1.bias torch.Size([64]) [64]\n",
      "layer3.3.bn1.running_mean layer3.3.bn1._mean torch.Size([64]) [64]\n",
      "layer3.3.bn1.running_var layer3.3.bn1._variance torch.Size([64]) [64]\n",
      "layer3.3.conv2.weight layer3.3.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.3.bn2.weight layer3.3.bn2.weight torch.Size([64]) [64]\n",
      "layer3.3.bn2.bias layer3.3.bn2.bias torch.Size([64]) [64]\n",
      "layer3.3.bn2.running_mean layer3.3.bn2._mean torch.Size([64]) [64]\n",
      "layer3.3.bn2.running_var layer3.3.bn2._variance torch.Size([64]) [64]\n",
      "layer3.4.conv1.weight layer3.4.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.4.bn1.weight layer3.4.bn1.weight torch.Size([64]) [64]\n",
      "layer3.4.bn1.bias layer3.4.bn1.bias torch.Size([64]) [64]\n",
      "layer3.4.bn1.running_mean layer3.4.bn1._mean torch.Size([64]) [64]\n",
      "layer3.4.bn1.running_var layer3.4.bn1._variance torch.Size([64]) [64]\n",
      "layer3.4.conv2.weight layer3.4.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.4.bn2.weight layer3.4.bn2.weight torch.Size([64]) [64]\n",
      "layer3.4.bn2.bias layer3.4.bn2.bias torch.Size([64]) [64]\n",
      "layer3.4.bn2.running_mean layer3.4.bn2._mean torch.Size([64]) [64]\n",
      "layer3.4.bn2.running_var layer3.4.bn2._variance torch.Size([64]) [64]\n",
      "layer3.5.conv1.weight layer3.5.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.5.bn1.weight layer3.5.bn1.weight torch.Size([64]) [64]\n",
      "layer3.5.bn1.bias layer3.5.bn1.bias torch.Size([64]) [64]\n",
      "layer3.5.bn1.running_mean layer3.5.bn1._mean torch.Size([64]) [64]\n",
      "layer3.5.bn1.running_var layer3.5.bn1._variance torch.Size([64]) [64]\n",
      "layer3.5.conv2.weight layer3.5.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.5.bn2.weight layer3.5.bn2.weight torch.Size([64]) [64]\n",
      "layer3.5.bn2.bias layer3.5.bn2.bias torch.Size([64]) [64]\n",
      "layer3.5.bn2.running_mean layer3.5.bn2._mean torch.Size([64]) [64]\n",
      "layer3.5.bn2.running_var layer3.5.bn2._variance torch.Size([64]) [64]\n",
      "layer3.6.conv1.weight layer3.6.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.6.bn1.weight layer3.6.bn1.weight torch.Size([64]) [64]\n",
      "layer3.6.bn1.bias layer3.6.bn1.bias torch.Size([64]) [64]\n",
      "layer3.6.bn1.running_mean layer3.6.bn1._mean torch.Size([64]) [64]\n",
      "layer3.6.bn1.running_var layer3.6.bn1._variance torch.Size([64]) [64]\n",
      "layer3.6.conv2.weight layer3.6.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.6.bn2.weight layer3.6.bn2.weight torch.Size([64]) [64]\n",
      "layer3.6.bn2.bias layer3.6.bn2.bias torch.Size([64]) [64]\n",
      "layer3.6.bn2.running_mean layer3.6.bn2._mean torch.Size([64]) [64]\n",
      "layer3.6.bn2.running_var layer3.6.bn2._variance torch.Size([64]) [64]\n",
      "layer3.7.conv1.weight layer3.7.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.7.bn1.weight layer3.7.bn1.weight torch.Size([64]) [64]\n",
      "layer3.7.bn1.bias layer3.7.bn1.bias torch.Size([64]) [64]\n",
      "layer3.7.bn1.running_mean layer3.7.bn1._mean torch.Size([64]) [64]\n",
      "layer3.7.bn1.running_var layer3.7.bn1._variance torch.Size([64]) [64]\n",
      "layer3.7.conv2.weight layer3.7.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.7.bn2.weight layer3.7.bn2.weight torch.Size([64]) [64]\n",
      "layer3.7.bn2.bias layer3.7.bn2.bias torch.Size([64]) [64]\n",
      "layer3.7.bn2.running_mean layer3.7.bn2._mean torch.Size([64]) [64]\n",
      "layer3.7.bn2.running_var layer3.7.bn2._variance torch.Size([64]) [64]\n",
      "layer3.8.conv1.weight layer3.8.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.8.bn1.weight layer3.8.bn1.weight torch.Size([64]) [64]\n",
      "layer3.8.bn1.bias layer3.8.bn1.bias torch.Size([64]) [64]\n",
      "layer3.8.bn1.running_mean layer3.8.bn1._mean torch.Size([64]) [64]\n",
      "layer3.8.bn1.running_var layer3.8.bn1._variance torch.Size([64]) [64]\n",
      "layer3.8.conv2.weight layer3.8.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.8.bn2.weight layer3.8.bn2.weight torch.Size([64]) [64]\n",
      "layer3.8.bn2.bias layer3.8.bn2.bias torch.Size([64]) [64]\n",
      "layer3.8.bn2.running_mean layer3.8.bn2._mean torch.Size([64]) [64]\n",
      "layer3.8.bn2.running_var layer3.8.bn2._variance torch.Size([64]) [64]\n",
      "layer3.9.conv1.weight layer3.9.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.9.bn1.weight layer3.9.bn1.weight torch.Size([64]) [64]\n",
      "layer3.9.bn1.bias layer3.9.bn1.bias torch.Size([64]) [64]\n",
      "layer3.9.bn1.running_mean layer3.9.bn1._mean torch.Size([64]) [64]\n",
      "layer3.9.bn1.running_var layer3.9.bn1._variance torch.Size([64]) [64]\n",
      "layer3.9.conv2.weight layer3.9.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.9.bn2.weight layer3.9.bn2.weight torch.Size([64]) [64]\n",
      "layer3.9.bn2.bias layer3.9.bn2.bias torch.Size([64]) [64]\n",
      "layer3.9.bn2.running_mean layer3.9.bn2._mean torch.Size([64]) [64]\n",
      "layer3.9.bn2.running_var layer3.9.bn2._variance torch.Size([64]) [64]\n",
      "layer3.10.conv1.weight layer3.10.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.10.bn1.weight layer3.10.bn1.weight torch.Size([64]) [64]\n",
      "layer3.10.bn1.bias layer3.10.bn1.bias torch.Size([64]) [64]\n",
      "layer3.10.bn1.running_mean layer3.10.bn1._mean torch.Size([64]) [64]\n",
      "layer3.10.bn1.running_var layer3.10.bn1._variance torch.Size([64]) [64]\n",
      "layer3.10.conv2.weight layer3.10.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.10.bn2.weight layer3.10.bn2.weight torch.Size([64]) [64]\n",
      "layer3.10.bn2.bias layer3.10.bn2.bias torch.Size([64]) [64]\n",
      "layer3.10.bn2.running_mean layer3.10.bn2._mean torch.Size([64]) [64]\n",
      "layer3.10.bn2.running_var layer3.10.bn2._variance torch.Size([64]) [64]\n",
      "layer3.11.conv1.weight layer3.11.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.11.bn1.weight layer3.11.bn1.weight torch.Size([64]) [64]\n",
      "layer3.11.bn1.bias layer3.11.bn1.bias torch.Size([64]) [64]\n",
      "layer3.11.bn1.running_mean layer3.11.bn1._mean torch.Size([64]) [64]\n",
      "layer3.11.bn1.running_var layer3.11.bn1._variance torch.Size([64]) [64]\n",
      "layer3.11.conv2.weight layer3.11.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.11.bn2.weight layer3.11.bn2.weight torch.Size([64]) [64]\n",
      "layer3.11.bn2.bias layer3.11.bn2.bias torch.Size([64]) [64]\n",
      "layer3.11.bn2.running_mean layer3.11.bn2._mean torch.Size([64]) [64]\n",
      "layer3.11.bn2.running_var layer3.11.bn2._variance torch.Size([64]) [64]\n",
      "layer3.12.conv1.weight layer3.12.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.12.bn1.weight layer3.12.bn1.weight torch.Size([64]) [64]\n",
      "layer3.12.bn1.bias layer3.12.bn1.bias torch.Size([64]) [64]\n",
      "layer3.12.bn1.running_mean layer3.12.bn1._mean torch.Size([64]) [64]\n",
      "layer3.12.bn1.running_var layer3.12.bn1._variance torch.Size([64]) [64]\n",
      "layer3.12.conv2.weight layer3.12.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.12.bn2.weight layer3.12.bn2.weight torch.Size([64]) [64]\n",
      "layer3.12.bn2.bias layer3.12.bn2.bias torch.Size([64]) [64]\n",
      "layer3.12.bn2.running_mean layer3.12.bn2._mean torch.Size([64]) [64]\n",
      "layer3.12.bn2.running_var layer3.12.bn2._variance torch.Size([64]) [64]\n",
      "layer3.13.conv1.weight layer3.13.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.13.bn1.weight layer3.13.bn1.weight torch.Size([64]) [64]\n",
      "layer3.13.bn1.bias layer3.13.bn1.bias torch.Size([64]) [64]\n",
      "layer3.13.bn1.running_mean layer3.13.bn1._mean torch.Size([64]) [64]\n",
      "layer3.13.bn1.running_var layer3.13.bn1._variance torch.Size([64]) [64]\n",
      "layer3.13.conv2.weight layer3.13.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.13.bn2.weight layer3.13.bn2.weight torch.Size([64]) [64]\n",
      "layer3.13.bn2.bias layer3.13.bn2.bias torch.Size([64]) [64]\n",
      "layer3.13.bn2.running_mean layer3.13.bn2._mean torch.Size([64]) [64]\n",
      "layer3.13.bn2.running_var layer3.13.bn2._variance torch.Size([64]) [64]\n",
      "layer3.14.conv1.weight layer3.14.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.14.bn1.weight layer3.14.bn1.weight torch.Size([64]) [64]\n",
      "layer3.14.bn1.bias layer3.14.bn1.bias torch.Size([64]) [64]\n",
      "layer3.14.bn1.running_mean layer3.14.bn1._mean torch.Size([64]) [64]\n",
      "layer3.14.bn1.running_var layer3.14.bn1._variance torch.Size([64]) [64]\n",
      "layer3.14.conv2.weight layer3.14.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.14.bn2.weight layer3.14.bn2.weight torch.Size([64]) [64]\n",
      "layer3.14.bn2.bias layer3.14.bn2.bias torch.Size([64]) [64]\n",
      "layer3.14.bn2.running_mean layer3.14.bn2._mean torch.Size([64]) [64]\n",
      "layer3.14.bn2.running_var layer3.14.bn2._variance torch.Size([64]) [64]\n",
      "layer3.15.conv1.weight layer3.15.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.15.bn1.weight layer3.15.bn1.weight torch.Size([64]) [64]\n",
      "layer3.15.bn1.bias layer3.15.bn1.bias torch.Size([64]) [64]\n",
      "layer3.15.bn1.running_mean layer3.15.bn1._mean torch.Size([64]) [64]\n",
      "layer3.15.bn1.running_var layer3.15.bn1._variance torch.Size([64]) [64]\n",
      "layer3.15.conv2.weight layer3.15.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.15.bn2.weight layer3.15.bn2.weight torch.Size([64]) [64]\n",
      "layer3.15.bn2.bias layer3.15.bn2.bias torch.Size([64]) [64]\n",
      "layer3.15.bn2.running_mean layer3.15.bn2._mean torch.Size([64]) [64]\n",
      "layer3.15.bn2.running_var layer3.15.bn2._variance torch.Size([64]) [64]\n",
      "layer3.16.conv1.weight layer3.16.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.16.bn1.weight layer3.16.bn1.weight torch.Size([64]) [64]\n",
      "layer3.16.bn1.bias layer3.16.bn1.bias torch.Size([64]) [64]\n",
      "layer3.16.bn1.running_mean layer3.16.bn1._mean torch.Size([64]) [64]\n",
      "layer3.16.bn1.running_var layer3.16.bn1._variance torch.Size([64]) [64]\n",
      "layer3.16.conv2.weight layer3.16.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.16.bn2.weight layer3.16.bn2.weight torch.Size([64]) [64]\n",
      "layer3.16.bn2.bias layer3.16.bn2.bias torch.Size([64]) [64]\n",
      "layer3.16.bn2.running_mean layer3.16.bn2._mean torch.Size([64]) [64]\n",
      "layer3.16.bn2.running_var layer3.16.bn2._variance torch.Size([64]) [64]\n",
      "layer3.17.conv1.weight layer3.17.conv1.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.17.bn1.weight layer3.17.bn1.weight torch.Size([64]) [64]\n",
      "layer3.17.bn1.bias layer3.17.bn1.bias torch.Size([64]) [64]\n",
      "layer3.17.bn1.running_mean layer3.17.bn1._mean torch.Size([64]) [64]\n",
      "layer3.17.bn1.running_var layer3.17.bn1._variance torch.Size([64]) [64]\n",
      "layer3.17.conv2.weight layer3.17.conv2.weight torch.Size([64, 64, 3, 3]) [64, 64, 3, 3]\n",
      "layer3.17.bn2.weight layer3.17.bn2.weight torch.Size([64]) [64]\n",
      "layer3.17.bn2.bias layer3.17.bn2.bias torch.Size([64]) [64]\n",
      "layer3.17.bn2.running_mean layer3.17.bn2._mean torch.Size([64]) [64]\n",
      "layer3.17.bn2.running_var layer3.17.bn2._variance torch.Size([64]) [64]\n",
      "linear.weight linear.weight torch.Size([10, 64]) [64, 10]\n",
      "linear.bias linear.bias torch.Size([10]) [10]\n"
     ]
    }
   ],
   "source": [
    "#实现权重转换\n",
    "pytorch_state_dict = torch_model.state_dict()\n",
    "paddle_state_dict = load_pytorch_pretrain_model(paddle_model, pytorch_state_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "cadbf4c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 保存模型权重\n",
    "import paddle\n",
    "paddle.save(paddle_state_dict, \"checkpoint/model_paddle.pdparams\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "a7983884",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[ 1.9227, -3.1553,  2.9445,  2.7719, -1.4646,  1.6979,  3.8195, -3.4764,\n",
      "         -1.6798, -3.3795]], grad_fn=<AddmmBackward>)\n"
     ]
    }
   ],
   "source": [
    "# 得到pytorch版本模型输出结果\n",
    "import numpy as np\n",
    "torch_model.eval()\n",
    "img = np.ones([1,3,32,32]).astype(\"float32\")\n",
    "img =torch.from_numpy(img)\n",
    "outputs_t = torch_model(img)\n",
    "print(outputs_t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "78e6d07f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tensor(shape=[1, 10], dtype=float32, place=CPUPlace, stop_gradient=False,\n",
      "       [[ 1.92266512, -3.15525961,  2.94448066,  2.77187514, -1.46463239,  1.69787252,  3.81953859, -3.47642469, -1.67979658, -3.37954140]])\n"
     ]
    }
   ],
   "source": [
    "# 得到paddle版本模型输出结果\n",
    "paddle_state_dict = paddle.load(\"checkpoint/model_paddle.pdparams\")\n",
    "paddle_model.set_state_dict(paddle_state_dict)\n",
    "paddle_model.eval()\n",
    "img = np.ones([1,3,32,32]).astype('float32')\n",
    "img = paddle.to_tensor(img)\n",
    "outputs_p = paddle_model(img)\n",
    "print (outputs_p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "340102cd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "outputs_p is equal to outputs_t\n"
     ]
    }
   ],
   "source": [
    "# 判断是否输出大致一致\n",
    "np.testing.assert_allclose(outputs_p.detach().numpy(), outputs_t.detach().numpy(), atol=8e-4)#默认rtol(相对容忍度)为1e-7，设绝对容忍度为8e-4\n",
    "print(\"outputs_p is equal to outputs_t\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "5684c810",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/home/lab-zhai.pucheng/code1/DNSD\n",
      "Namespace(checkpoint='checkpoint/model_paddle.pdparams', data_dir='data', dataset='cifar10', drop_path_rate=0.5, epochs=500, gamma=0.1, high_level_api=False, learning_rate=0.1, milestones=[250, 375], mode='train', momentum=0.9, nesterov=True, net='resnet110', optimizer='sgd', save_best=False, save_dir='output', save_interval=10, test_batch_size=128, train_batch_size=128, weight_decay=0.0001)\n",
      "totoal blocks num: 54\n",
      "0:0.009259259259259259\n",
      "1:0.018518518518518517\n",
      "2:0.027777777777777776\n",
      "3:0.037037037037037035\n",
      "4:0.046296296296296294\n",
      "5:0.05555555555555555\n",
      "6:0.06481481481481481\n",
      "7:0.07407407407407407\n",
      "8:0.08333333333333333\n",
      "9:0.09259259259259259\n",
      "10:0.10185185185185185\n",
      "11:0.1111111111111111\n",
      "12:0.12037037037037036\n",
      "13:0.12962962962962962\n",
      "14:0.1388888888888889\n",
      "15:0.14814814814814814\n",
      "16:0.1574074074074074\n",
      "17:0.16666666666666666\n",
      "18:0.17592592592592593\n",
      "19:0.18518518518518517\n",
      "20:0.19444444444444445\n",
      "21:0.2037037037037037\n",
      "22:0.21296296296296297\n",
      "23:0.2222222222222222\n",
      "24:0.23148148148148148\n",
      "25:0.24074074074074073\n",
      "26:0.25\n",
      "27:0.25925925925925924\n",
      "28:0.26851851851851855\n",
      "29:0.2777777777777778\n",
      "30:0.28703703703703703\n",
      "31:0.2962962962962963\n",
      "32:0.3055555555555556\n",
      "33:0.3148148148148148\n",
      "34:0.32407407407407407\n",
      "35:0.3333333333333333\n",
      "36:0.3425925925925926\n",
      "37:0.35185185185185186\n",
      "38:0.3611111111111111\n",
      "39:0.37037037037037035\n",
      "40:0.37962962962962965\n",
      "41:0.3888888888888889\n",
      "42:0.39814814814814814\n",
      "43:0.4074074074074074\n",
      "44:0.4166666666666667\n",
      "45:0.42592592592592593\n",
      "46:0.4351851851851852\n",
      "47:0.4444444444444444\n",
      "48:0.4537037037037037\n",
      "49:0.46296296296296297\n",
      "50:0.4722222222222222\n",
      "51:0.48148148148148145\n",
      "52:0.49074074074074076\n",
      "53:0.5\n",
      "Loading data...\n",
      "Finish loading! tran data length:45000, val data length:5000, test data length:10000\n",
      "Test: [0/79]\tTime 2.745 (2.745)\tLoss 0.3062 (0.3062)\tPrec@1 94.531 (94.531)\tPrec@5 99.219 (99.219)\n",
      "Test: [26/79]\tTime 2.459 (2.628)\tLoss 0.4058 (0.2914)\tPrec@1 94.531 (94.618)\tPrec@5 100.000 (99.769)\n",
      "Test: [52/79]\tTime 2.656 (2.643)\tLoss 0.3545 (0.2754)\tPrec@1 94.531 (94.944)\tPrec@5 99.219 (99.823)\n",
      "Test: [78/79]\tTime 0.397 (2.621)\tLoss 0.6857 (0.2670)\tPrec@1 93.750 (95.030)\tPrec@5 100.000 (99.830)\n",
      " * Prec@1 95.030 Prec@5 99.830 Time 2.621\n"
     ]
    }
   ],
   "source": [
    "# 在cifar10 测试集上评估，已知pytorch 模型的test acc为95.03%\n",
    "%cd ../DNSD/\n",
    "!python eval.py --checkpoint checkpoint/model_paddle.pdparams"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "493f3e69",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 由此可见，模型转换基本没有问题！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4087b81d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
